'use strict';
module.exports = app => {
  const { router, controller, middleware } = app;
  /**
   * 上传文件
   */
  router.post('/api/upload/file', controller.uploadcos.file);
  // banner
  router.get('/api/banner/list', controller.banner.allList);
  router.resources('banner', '/api/banner', controller.banner);
  // 产品分类
  router.get('/api/productCategory/list', controller.productCategory.allList);
  router.resources('productCategory', '/api/productCategory', controller.productCategory);
  // 产品
  router.get('/api/product/list', controller.product.allList);
  router.resources('product', '/api/product', controller.product);
  // 贷款申请
  router.get('/api/product-application/list', controller.productApplication.allList);
  router.resources('productApplication', '/api/product-application', controller.productApplication);
  // 文件
  router.resources('file', '/api/file', controller.file);
  /**
   * 用户
   */
  // 用户
  router.get('/api/user/list', controller.user.allList);
  // 注册、登录
  router.post('/api/user/register', controller.user.register);
  router.post('/api/user/login', controller.user.login);
  router.resources('user', '/api/user', controller.user);

  // 租户登录/system/auth/login
  router.post('/api/system/auth/login', controller.systemUser.login)
  // 获取租户信息和权限
  router.get('/api/system/auth/get-permission-info', middleware.auth(), controller.systemUser.getUserInfo)
  router.resources('/api/system/user', controller.systemUser);
  // 租户菜单
  router.get('/api/system/menu/tree', controller.systemMenu.tree);
  router.resources('/api/system/menu', controller.systemMenu);  
};
